Neurosis Engine
window.h
Go to the documentation of this file.
00001 
00002 // Neurosis Engine - LP23.com
00003 // Copyright © Luigi Pino. All rights reserved.
00004 
00005 /***************************************************************************/
00006 
00007 #ifndef _NEUROSIS_ENGINE_WINDOW_H_
00008 #define _NEUROSIS_ENGINE_WINDOW_H_
00009 
00010 /***************************************************************************/
00011 
00012 #include <vfw.h>
00013 #include <gdiplus.h>
00014 using namespace Gdiplus;
00015 
00016 /***************************************************************************/
00017 
00018 class CNeurosisWindow {
00019   public:
00020     CNeurosisWindow(float zNear, float zFar, char *engineLogFilename = NULL);
00022     ~CNeurosisWindow();
00023 
00025     void    Font_Begin(int iTexture);
00027     void    Font_End();
00029     bool    Font_List_Load(char *filename);
00031     void    Font_List_Print(float x, float y, float size, float r, float g, float b, bool alignCenter, bool alignRight, const char *fmt, ...);
00033     void    Font_String(float x, float y, float size, float r, float g, float b, bool centerText, const char *fmt, ...);
00035     int     Get_Previous_Texture();
00037     int     Get_Total_Textures();
00039     void    GL_Cleanup();
00041     bool    GL_Create_Window(char *title, int width, int height, int bits, bool fullscreen, bool allowResize, bool centerWindow, bool showCursor);
00043     void    GL_Initialize();
00045     void    GL_Perspective(float field_of_view, float aspect);
00047     POINT   Mouse_Coordinates();
00049     void    Process_Messages();
00051     void    Render_Triangle(int iTexture, float r, float g, float b, float transparency, float bottomLeftX, float bottomLeftY, float bottomLeftZ, float topRightX, float topRightY, float topRightZ, float topLeftX, float topLeftY, float topLeftZ, float bottomLeftPercentX = 0.0f, float bottomLeftPercentY = 0.0f, float topRightPercentX = 1.0f, float topRightPercentY = 1.0f, float topLeftPercentX = 0.0f, float topLeftPercentY = 1.0f);
00053     void    Render_Quad(int iTexture, float r, float g, float b, float transparency, float bottomLeftX, float bottomLeftY, float bottomLeftZ, float bottomRightX, float bottomRightY, float bottomRightZ, float topRightX, float topRightY, float topRightZ, float topLeftX, float topLeftY, float topLeftZ, float bottomLeftPercentX = 0.0f, float bottomLeftPercentY = 0.0f, float bottomRightPercentX = 1.0f, float bottomRightPercentY = 0.0f, float topRightPercentX = 1.0f, float topRightPercentY = 1.0f, float topLeftPercentX = 0.0f, float topLeftPercentY = 1.0f);
00055     void    Resize_Window(int width, int height);
00057     void    Screenshot_Capture(char *filename, bool isDesktop, int customX = 0, int customY = 0, int customWidth = 0, int customHeight = 0);
00059     void    Set_Previous_Texture(int iTexture);
00061     void    Set_Window_Title(char *title);
00063     GLuint  Texture_Get_Data(int index);
00065     char*   Texture_Get_Name(int index);
00067     int     Texture_Load(char *filename, int index = -1);
00069     void    Texture_Remove(int index);
00071     void    Texture_Remove_All();
00073     void    Textures_Reload();
00075     void    Video_Capture(float timeStep);
00077     void    Video_Cleanup();
00079     void    Video_Initialize(char *filename, int desiredFPS);
00080 
00081     HDC       hDC;                                    // Private GDI device context
00082     HINSTANCE hInstance;                              // Instance of program
00083     HWND      hWnd;                                   // Window handle
00084 
00085     bool      pKeys[256];                             // Keyboard array
00086     FILE      *pEngineLog;                            // Engine information file
00087     float     pFontList[128][4];                      // Font list array
00088 
00089     bool      mActive;                                // Whether program is active
00090     bool      mMinimized;                             // Whether program is minimized
00091     MSG       mMsg;                                   // Message structure
00092     bool      mQuit;                                  // Quit program flag
00093     float     mZFar;                                  // Z buffer far boundary
00094     float     mZNear;                                 // Z buffer near boudary
00095     int       mScreenHeight;                          // Screen resolution height
00096     int       mScreenWidth;                           // Screen resolution width
00097 
00098   private:
00099     struct STexture {
00100       char          *pFilename;                       // Filename of texture
00101       unsigned int  mTextureID;                       // Texture ID
00102     };
00103 
00105     bool    Build_GDI(char *filename, int index);
00107     float3  Font_String_Get_Percent(int letter);
00109     int     Get_Encoder_Clsid(const WCHAR *format, CLSID *pClsid);
00110 
00111     HGLRC               hRC;                          // Permanent rendering context
00112 
00113     STexture            *pTextures;                   // Texture pointer
00114     PAVIFILE            pVideoFile;                   // Video file handle
00115     PAVISTREAM          pVideoStream;                 // Video stream
00116 
00117     bool                mFullscreen;                  // Fullscreen flag
00118     float               mVideoDesiredTimeInterval;    // 1 / desiredFPS from Video_Initialize()
00119     float               mVideoTimeLapse;              // Used for when to store next video frame
00120     GdiplusStartupInput mGdiplusStartupInput;         // GDI+
00121     int                 mPreviousTexture;             // Texture that was last used
00122     int                 mTotalTextures;               // Total textures loaded
00123     long                mVideoFrame;                  // Current video frame
00124     ULONG_PTR           mGdiplusToken;                // GDI+
00125 };
00126 
00127 /***************************************************************************/
00128 #endif